//
//  YButtonView.swift
//  BodyBuilding
//
//  Created by franze on 2017/11/1.
//  Copyright © 2017年 franze. All rights reserved.
//

import UIKit

class YButtonView: UIView {

    var firstBtn,secondBtn:UIButton!
    var circle:Circle!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
    
    func initialize(titles:[String]){
        layer.shadowPath = UIBezierPath(rect: CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height)).cgPath
        layer.shadowColor = UIColor.gray.cgColor
        layer.shadowOffset = CGSize(width: 0, height: 0)
        layer.shadowOpacity = 0.5
        layer.shadowRadius = 2
        
        circle = Circle(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
        circle.initialize(color: UIColor.red)
        circle.center = CGPoint(x: bounds.width/2-40, y: bounds.height/2)
        addSubview(circle)
        
        firstBtn = UIButton(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
        firstBtn.setTitle(titles[0], for: .normal)
        firstBtn.setTitleColor(.black, for: .normal)
        firstBtn.center = CGPoint(x: bounds.width/2-40, y: bounds.height/2)
        firstBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
        firstBtn.tag = 1
        addSubview(firstBtn)
        
        secondBtn = UIButton(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
        secondBtn.setTitle(titles[1], for: .normal)
        secondBtn.setTitleColor(.black, for: .normal)
        secondBtn.center = CGPoint(x: bounds.width/2+40, y: bounds.height/2)
        secondBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
        secondBtn.tag = 2
        addSubview(secondBtn)        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
